local function main(userOb, msgData)
    if not msgData.GoodFriendId then
        return
    end 
    local userId = userOb:query_temp("userId")
    local res = userOb:change_todo_friend(userId,msgData.GoodFriendId,1)
    local result = {}
    if res then
        result.code = 200
        result.status = "success"
    else
        result.code = 400
        result.status = "fail"
    end
    --双向好友添加
    rpc.from_user = msgData.GoodFriendId
    rpc.to_user =  userId
    rpc.type = 1
    rpc.behavior = "add"
    rpc.method = "change_task"
    local ok, data = THREAD_D:send("database_yield", rpc) 
    
    userOb:send_packet("MSGS2CGoodFriendPASS", result)  
end

--注册方法
COMMAND_D:register_command("MSGC2SGoodFriendPASS",GameCmdType.NONE, main)